﻿using System;
using UnityEngine;
using UnityEngine.SceneManagement;

// Token: 0x020002F8 RID: 760
public class SceneControl
{
	// Token: 0x06001379 RID: 4985 RVA: 0x0008B8B0 File Offset: 0x00089AB0
	public SceneControl()
	{
		this.IsReserve = false;
		this.NowSceneName = SceneManager.GetSceneAt(SceneManager.sceneCount - 1).name;
	}

	// Token: 0x170001CF RID: 463
	// (get) Token: 0x0600137A RID: 4986 RVA: 0x0008B8F0 File Offset: 0x00089AF0
	// (set) Token: 0x0600137B RID: 4987 RVA: 0x0008B8F8 File Offset: 0x00089AF8
	public Color FadeColor { get; private set; }

	// Token: 0x170001D0 RID: 464
	// (get) Token: 0x0600137C RID: 4988 RVA: 0x0008B904 File Offset: 0x00089B04
	// (set) Token: 0x0600137D RID: 4989 RVA: 0x0008B90C File Offset: 0x00089B0C
	public float FadeTime { get; private set; }

	// Token: 0x170001D1 RID: 465
	// (get) Token: 0x0600137E RID: 4990 RVA: 0x0008B918 File Offset: 0x00089B18
	public bool IsFading
	{
		get
		{
			return this.fade != null;
		}
	}

	// Token: 0x170001D2 RID: 466
	// (get) Token: 0x0600137F RID: 4991 RVA: 0x0008B928 File Offset: 0x00089B28
	// (set) Token: 0x06001380 RID: 4992 RVA: 0x0008B930 File Offset: 0x00089B30
	public bool IsReserve { get; private set; }

	// Token: 0x170001D3 RID: 467
	// (get) Token: 0x06001381 RID: 4993 RVA: 0x0008B93C File Offset: 0x00089B3C
	// (set) Token: 0x06001382 RID: 4994 RVA: 0x0008B944 File Offset: 0x00089B44
	public string NowSceneName { get; private set; }

	// Token: 0x170001D4 RID: 468
	// (get) Token: 0x06001383 RID: 4995 RVA: 0x0008B950 File Offset: 0x00089B50
	// (set) Token: 0x06001384 RID: 4996 RVA: 0x0008B958 File Offset: 0x00089B58
	public string PrevSceneName { get; private set; }

	// Token: 0x06001385 RID: 4997 RVA: 0x0008B964 File Offset: 0x00089B64
	public void Change(string sceneName, string msg, Color color, float fadeTime, float fedeDeley = 0f, bool inSkip = false)
	{
		if (this.IsReserve)
		{
			GlobalData.Debug_LogWarning("场景切换中" + sceneName + "转换失败");
			return;
		}
		this.changeMsg = msg;
		this.FadeTime = fadeTime;
		this.FadeColor = color;
		if (inSkip)
		{
			this.Change(sceneName);
		}
		else
		{
			this.IsReserve = true;
			this.fade = ScreenFade.StartFade(ScreenFade.TYPE.OUT, color, fadeTime, fedeDeley, delegate
			{
				this.Change(sceneName);
			}, false);
		}
	}

	// Token: 0x06001386 RID: 4998 RVA: 0x0008BA00 File Offset: 0x00089C00
	public void Change(string sceneName)
	{
		this.PrevSceneName = this.NowSceneName;
		this.NowSceneName = sceneName;
		this.IsReserve = false;
		if (this.nowScene != null)
		{
			this.nowScene.OutScene(sceneName);
		}
		SceneManager.LoadScene(sceneName);
	}

	// Token: 0x06001387 RID: 4999 RVA: 0x0008BA40 File Offset: 0x00089C40
	public string RequestChangeMessage()
	{
		string result = this.changeMsg;
		this.changeMsg = string.Empty;
		return result;
	}

	// Token: 0x06001388 RID: 5000 RVA: 0x0008BA60 File Offset: 0x00089C60
	public void SetScene(global::Scene newScene)
	{
		this.nowScene = newScene;
	}

	// Token: 0x04001887 RID: 6279
	private global::Scene nowScene;

	// Token: 0x04001888 RID: 6280
	private string changeMsg = string.Empty;

	// Token: 0x04001889 RID: 6281
	private ScreenFade fade;
}
